/*
 * Copyright Hundsun Technologies Inc. All Rights Reserved.
 */

// 定义boss执行器和worker执行器公用的数据类型

package common

import (
	lru "github.com/hashicorp/golang-lru"
	"hundsun.com/hsl/hschain/protos/ledger"
	dbm "hundsun.com/hsl/hschain/store/db"
	"hundsun.com/hsl/hschain/store/mq"
	"hundsun.com/hsl/hschain/store/state"
)

const (
	// ConfigKeyContract config key contract
	ConfigKeyContract = "contract"
)

// ExecContent TODO 后续可以加入,系统合约的一些接口，如通过获取acl控制权限接口;;;Content后续需要设计的更加简洁一点，对于localcache
type ExecContent struct {
	header    *ledger.BlockHeader
	stateHash []byte
	stateHdl  *StateHandle // 状态数据句柄
	ledgerHdl dbm.Database // 账本数据
}

// StateHandle 状态数据处理对象
type StateHandle struct {
	client mq.Client
	// 本次执行的临时缓存
	tempCache map[string][]byte
	// 之前状态数据
	preState map[string][]byte
	statedb  state.State
	// lru 状态数据缓存
	lruState *lru.Cache
}
